*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --highlight-color: var(--pink-8);
}

nav {
  width: 420px;
  flex: 0 0 auto;

  @media (max-width: 768px) {
    width: 100%;
  }
}

main {
  display: flex;
  position: relative;
  overflow: hidden;
  flex: 1 1 auto;
  padding: 24px;
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

.rt-RadioCardsItem {
  text-align: center;
}

main .rt-BaseCard {
  --card-padding: var(--space-5);

  box-shadow: var(--shadow-4);

  min-width: 240px;
  min-height: 240px;
  max-width: 92%;
  max-height: 92%;
  width: 340px;
  height: 340px;
  resize: both;
  will-change: width, height;

  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  margin: auto;

  transition: 0.3s ease-out;
  transition-property: background, border, padding;

  & .highlight {
    position: absolute;
    inset: 20px;
    border-radius: 16px;
    border: 4px solid var(--highlight-color);
    pointer-events: none;

    animation: fadeOut 1s ease-out forwards;
  }

  & .inner {
    border-radius: calc(var(--card-border-radius));
    width: 100%;
    height: 100%;
    flex: 1 1 auto;
    padding: var(--card-padding);

    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;

    transition: inherit;

    & i {
      color: var(--highlight-color);
    }

    & .rt-Code {
      text-decoration: underline dotted;
      cursor: help;
    }
  }

  &[data-debug-colors='true'] {
    --card-background-color: var(--green-4);
    box-shadow: var(--shadow-1);
    & .inner {
      background: var(--blue-4);
      box-shadow: var(--shadow-1);
    }
  }
}

body:has(#debug-hover:hover) main .rt-BaseCard,
main .rt-BaseCard:has(code:hover),
main .rt-BaseCard:has(code[data-state*='open']) {
  --card-background-color: var(--green-4);
  box-shadow: var(--shadow-1);
  & .inner {
    background: var(--blue-4);
    box-shadow: var(--shadow-1);
  }
}

.snippet {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  margin-top: 8px;

  & > code {
    min-height: 40px;
    display: flex;
    align-items: center;
    width: 100%;
    padding: 12px;
  }

  & > button {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);

    box-sizing: border-box;
    padding: 4px;
    margin: 0;
    width: 32px;
    height: 32px;

    & svg {
      --size: 20px;
      width: var(--size);
      height: var(--size);
    }
  }
}

#debug-hover {
  cursor: help;
  border: 1px dashed var(--accent-a6);
  box-shadow: none;

  & p > em {
    text-decoration: underline dotted;
  }

  /* Hide if device doesn't support hover */
  @media (hover: none) {
    display: none;
  }
}
